package exo1;

import exception.CompteFermeException;
import exception.CompteNonTransferableException;
import exception.CreditSurPlafondException;
import exception.DebitNonAutoriseException;
import exception.DebitSousSeuilException;

public abstract class Compte {
	private Personne nom;
	private int numero;
	private double solde;
	private boolean ouvert;
	private final int type;

	public Compte(Personne nom, int numero, double solde, int type) {
		this.nom = nom;
		this.numero = numero;
		this.solde = solde;
		this.type = type;
		this.ouvert = true;
	}

	public abstract boolean transferer(Compte compte, double montant)
			throws DebitNonAutoriseException, DebitSousSeuilException,
			CreditSurPlafondException, CompteFermeException,CompteNonTransferableException;

	public abstract boolean debiter(double montant)
			throws DebitNonAutoriseException, DebitSousSeuilException, CompteFermeException;

	public abstract boolean crediter(double montant)
			throws CreditSurPlafondException, CompteFermeException;

	public Personne getNom() {
		return nom;
	}

	public int getNumero() {
		return numero;
	}

	public double getSolde() {
		return solde;
	}

	public void setSolde(double solde) {
		this.solde = solde;
	}

	public boolean isOuvert() {
		return ouvert;
	}
	
	public void setOuvert(boolean ouvert) {
		this.ouvert = ouvert;
	}

	public int getType() {
		return type;
	}

	@Override
	public String toString() {
		return nom + ", numero du compte = " + numero + ", solde = "
				+ solde;
	}

}
